<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工信息</title>
<jsp:include page="../../../common.jsp"></jsp:include>



<script type="text/javascript">
$(function () {

    //1.初始化Table
    var oTable = new TableInit();
    oTable.Init();

    //2.初始化Button的点击事件
    var oButtonInit = new ButtonInit();
    oButtonInit.Init();
	//初始化提示框的位置：top-center，bottom-left，bottom-right
    toastr.options.positionClass = 'toast-top-center';
	
    $('#exampleModal').on('hide.bs.modal',function(){
    	$("#fm")[0].reset();
    	$('#fm').data('bootstrapValidator').resetForm(true);
    });
    
    $('#pass').change(function () {
    	$("#pass2").val("");
    });
    
  	//jQuery，既阻止默认行为又停止冒泡
    $("#ss").on('click',function(){
    	    return false;//当然 也阻止了事件本身
    });

});


var TableInit = function () {
    var oTableInit = new Object();
    //初始化Table
    oTableInit.Init = function () {
        $('#tb_departments').bootstrapTable({
            url: '${pageContext.request.contextPath }/staff/list.do',         //请求后台的URL（*）
            //showExport: true, //是否显示导出
            method: 'get',                      //请求方式（*）
            toolbar: '#toolbar',                //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            sortable: false,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            queryParams: oTableInit.queryParams,//传递参数（*）
            sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
            pageNumber:1,                       //初始化加载第一页，默认第一页
            pageSize: 10,                       //每页的记录行数（*）
            pageList: [10, 20, 30],        //可供选择的每页的行数（*）
            //search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
            strictSearch: true,
            //showColumns: true,                  //是否显示所有的列
            //showRefresh: true,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
           // height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "staid",                     //每一行的唯一标识，一般为主键列
            //showToggle:true,                    //是否显示详细视图和列表视图的切换按钮
            //cardView: false,                    //是否显示详细视图
            detailView: false,                   //是否显示父子表
            columns: [{
                checkbox: true
            }, {
                field: 'staid',
                title: 'id',
                visible: false
            }, {
                field: 'scode',
                title: '账号'
            }, {
                field: 'sname',
                title: '姓名'
           /*  }, {
                field: 'pass',
                title: '密码' */
            }, {
                field: 'sex',
                title: '性别'
            }, {
                field: 'sbir',
                title: '出生日期',
                formatter:formatdate
            /* }, {
                field: 'reg.rname',
                title: '地区'  */
            }, {
                field: 'department.dname',
                title: '部门'
            }, {
                field: 'job.jname',
                title: '职务'
            }/* , {
                field: 'isndate',
                title: '入职日期',
                formatter:formatdate
            }*/, {
                field: 'sway',
                title: '电话'
            } , {
                field: 'seducation',
                //align: 'center',
                title: '学历'
            }/* , {
                field: 'sschool',
                title: '学校'
            }, {
                field: 'smajor',
                title: '专业'
            }, {
                field: 'sqq',
                title: 'QQ'
            }, {
                field: 'smail',
                title: '邮箱'
            }, {
                field: 'saddress',
                title: '家庭住址'
            }, {
                field: 'sman',
                title: '紧急联系人'
            }, {
                field: 'stele',
                title: '紧急联系方式'
            } */, {
                field: 'sreserve1',
                title: '签名信息',
            	formatter:function(value,row,index){
            		if(value != null && value != "") {
            			return '<img width="120px" height="80px" border="0" src="${pageContext.request.contextPath }/staff/myPicture.do?id='+row.staid+'"/>';
            		}else {
            			return "";
            		}
	            },
            }, {
                field: 'sreserve2',
                title: '是否有审批权限'
            }, {
                field: 'sreserve3',
                title: '角色'
            }, {
                field: 'sremark',
                title: '备注'
            }, {
                field: 'sentry',
                title: '创建人'
            }, {
                field: 'sentrytime',
                title: '创建时间'
            }]
        });
    };

    //得到查询的参数
    oTableInit.queryParams = function (params) {
        var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            page: params.offset/params.limit+1,   //页面大小
            pageSize: params.limit,  //页码
            sname:$.trim($('#snameTJ').val()), 
    		sex:$.trim($('#sexTJ').val()),   
        };
        return temp;
    };
    return oTableInit;
};


var ButtonInit = function () {
    var oInit = new Object();
    var postdata = {};

    oInit.Init = function () {
        //初始化页面上面的按钮事件
    };

    return oInit;
};

//格式化
function formatdate(val,row){
	if (val == "" || val == null) {
		return "";
	}
	var date = new Date(val);
    return date.getFullYear() + '-' + add0((date.getMonth() + 1)) + '-' + add0(date.getDate());  
}
function add0(m) {
	return m<10?'0'+m:m
}
function refresh(){
	setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
		var row=$('#tb_departments').bootstrapTable('getData');
		if(row.length == 0){
			window.location.reload();
		}
	},1000);
}

function doDelete() {
	var row=$.map($("#tb_departments").bootstrapTable('getSelections'),function(row){
		return row ;
	});
	if (row.length == 0) {
		toastr.warning('请至少选择一条数据!');
	}else{
		var ids="";
		for(var i=0;i<row.length;i++){
			if(i==0 || i=="0"){
				ids+=row[i].staid;
			}else{
				ids+=","+row[i].staid;
			}
		}
		
		//询问框
		Ewin.confirm({ message: "确认要删除选择的数据吗？" }).on(function (e) {
	       if (!e) {
	         return;
	       } 
	    	var url = "${pageContext.request.contextPath }/staff/delete.do";
		    $.post(url, "ids="+ids, function(data) {
				if (data == 1) {
					toastr.success('删除成功');
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						$('#tb_departments').bootstrapTable('refresh');
						refresh()
					},1000);
				} else {
					toastr.error('删除失败');
					setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
						$('#tb_departments').bootstrapTable('refresh');
						refresh()
					},1000);
				}
			}); 
	    }); 
	}
}

function doAdd() {
	
	$("#bt").html("新增员工信息(默认密码为123)");
	$("#staid").val("");
	$("#pass").val("123");
	$("#pass2").val("123"); 
	
	$('#sex').selectpicker('val',(""));
	//$('#rid').selectpicker('val',(""));
	$('#did').selectpicker('val',(""));
	$('#pid').selectpicker('val',(""));
	$('#sreserve2').selectpicker('val',(""));
	$('#sreserve3').selectpicker('val',(""));
	$('#seducation').selectpicker('val',(""));
	$('#exampleModal').modal(open);
}
function add0(m){return m<10?'0'+m:m }
function FormatDate (strTime) {
    var date = new Date(strTime);
    return date.getFullYear()+"-"+add0((date.getMonth()+1))+"-"+add0(date.getDate());
}
function doView() {
	//取表格的选中行数据
    var row = $("#tb_departments").bootstrapTable('getSelections');
	if (row.length == 1) {
		$("#bt").html("修改员工信息");
		$("#staid").val(row[0].staid);
		$("#scode").val(row[0].scode);
		$("#sname").val(row[0].sname);
		$('#sex').selectpicker('val',(row[0].sex));
		
		if(row[0].sbir != null && row[0].sbir != "" && row[0].sbir != undefined) {
			$("#sbir").val(FormatDate(new Date(row[0].sbir)));
		}		
		
		//$('#rid').selectpicker('val',(row[0].rid));
		$('#did').selectpicker('val',(row[0].did));
		$('#pid').selectpicker('val',(row[0].pid));
		$('#seducation').selectpicker('val',(row[0].seducation));
		$("#sschool").val(row[0].sschool);
		$("#smajor").val(row[0].smajor);
		
		
		$("#isndate").val(FormatDate(new Date(row[0].isndate)));
		
		$("#sway").val(row[0].sway);
		$("#sqq").val(row[0].sqq);
		$("#smail").val(row[0].smail);
		$("#saddress").val(row[0].saddress);
		$("#sman").val(row[0].sman);
		$("#stele").val(row[0].stele);
		$("#sremark").val(row[0].sremark);
		$("#sreserve2").selectpicker('val',(row[0].sreserve2));
		$('#sreserve3').selectpicker('val',(row[0].sreserve3));
		$('#exampleModal').modal(open);
	}else{
		toastr.warning('请选择一条数据!');
	}
}
function save() {
	
	var bootstrapValidator = $("#fm").data('bootstrapValidator');  
    
    //开启验证
    bootstrapValidator.validate();  
    if (bootstrapValidator.isValid()){
    	
    	//限制文件大小  
     	var file1 = $("#photo").val();
     	if(file1.length > 0){
 	        var fileSize1 = document.getElementById('photo').files[0].size;  
 	        if(fileSize1>=1024*100)  
 	        {  
 	        	toastr.warning('上传视图片超出大小，请选择小一点的图片！');  
 	            return false;  
 	        } 
     	}
    	
    	if (document.getElementById('staid').value=='') {
    		if(document.getElementById('pass').value==''){
    			$("#pass").val("123");
    		}
			var url = "${pageContext.request.contextPath }/staff/add.do";
			var title="新增";
    	} else {
			var url = "${pageContext.request.contextPath }/staff/update.do";
			var title="修改";
    	}  
    	

	    var formData = new FormData($("#fm")[0]); 
    	$.ajax({
				url : url,
				 type: 'post',  
		          data: formData,
		          async: false,  
		          cache: false,  
		          contentType: false,  
		          processData: false,
				success : function(data) {
					var data=eval("("+data+")");
					if (data == 1) {
						toastr.success(title+'成功');
						setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
							if (document.getElementById('staid').value=='') {
								$('#exampleModal').modal('hide');
								$('#tb_departments').bootstrapTable('refresh'); 
								refresh();
							}else{
								$('#exampleModal').modal('hide');
								
								window.location.reload();
							}
						},1000);
					} else {
						toastr.error(title+'失败，工号不能重复');
					}
				}
		});
    }else{
	    return;  
    }  
}


function seach() {
	$("#tb_departments").bootstrapTable("refreshOptions",{pageNumber:1})
	//window.location.reload();
	//$('#tb_departments').bootstrapTable('refresh'); 
}
</script>
</head>
<body>
	<div class="panel-body" style="padding-bottom:0px;">
        <div class="panel panel-default">
            <!-- <div class="panel-heading">查询条件</div> -->
            <div class="panel-body" style="padding: 5px;">
                <form id="formSearch" class="form-horizontal">
                    <div class="form-group" style="margin-top:15px;margin: 0px;" >
                        <label class="control-label col-sm-1" for="txt_search_departmentname">姓名 </label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="snameTJ">
                        </div>
                        <label class="control-label col-sm-1" for="txt_search_statu">性别</label>
                        <div class="col-sm-3">
                            <!-- <input type="text" class="form-control" id="sexTJ"> -->
                            <select id="sexTJ" class="form-control selectpicker" >
								<option value="">请选择</option>
								<option>男</option>
								<option>女</option>
							</select>
                        </div>
                        <div class="col-sm-4" style="text-align:left;">
                            <button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="seach()">查询</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>       

        <div id="toolbar" class="btn-group">
            <button id="btn_add" type="button" class="btn btn-default" onclick="doAdd()">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
            </button>
            <button id="btn_edit" type="button" class="btn btn-default" onclick="doView()">
           		 <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
            </button>
            <button id="btn_delete" type="button" class="btn btn-default" onclick="doDelete()">
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
            </button>
            <button id="btn_add" type="button" class="btn btn-default" onclick="douploadModal()">
                <span class="glyphicon glyphicon-bullhorn" aria-hidden="true"></span>导入
            </button>
            <button id="btn_delete" type="button" class="btn btn-default" onclick="doExportall()">
                <span class="glyphicon glyphicon-export" aria-hidden="true"></span>导出所有
            </button>
            
            
            <script type="text/javascript">
	        	function doExport() {
	        		Ewin.confirm({message : "确认导出所有数据吗？"}).on(
    					function(e) {
   						if (!e) {return;}
						window.location.href="${pageContext.request.contextPath}/staff/doExport.do"; 
					})
				}
	        	function doExportall() {
	        		Ewin.confirm({message : "确认导出所有数据吗？"}).on(
    					function(e) {
   						if (!e) {return;}
						window.location.href="${pageContext.request.contextPath}/staff/doExportall.do"; 
					})
				}
	        	
	        	function douploadModal() {
	        		$('#uploadModal').modal(open);
	        		//清空表单
	        		document.getElementById("importForm").reset();
	        	}
	        	
	        	function uploadBtn() {
	        		 var fileName = $("#fileInput").val();
	        		 if (fileName.length > 0) {
	        		     var formData = new FormData($("#importForm")[0]);  
	        		     $.ajax({  
	        		          url: '${pageContext.request.contextPath}/staff/uplodeFile.do' ,  
	        		          type: 'post',  
	        		          data: formData,
	        		          async: false,  
	        		          cache: false,  
	        		          contentType: false,  
	        		          processData: false,  
	        		          success: function (data) { 
	        		        	  if (data == 1) {
	        		        		  toastr.success("文件导入成功！");
	        		        		  setTimeout(function() {//使用setTimeout()方法设定定时2000毫秒
	        		        		    $('#uploadModal').modal('hide'); 
	        		        		   $('#tb_departments').bootstrapTable('refresh'); 
	        						  },1000);
	        		        	  }else if(data == -1){
	        		        		  toastr.warning("导入的数据不符合导入条件（部门不能重复）！");  
	        		        	  }else{
	        		        		  toastr.warning("文件格式异常，文件导入失败！");  
	        		        	  }
	        		          },  
	        		          error: function (data) {
	        		        	  toastr.error("文件格式异常，文件导入失败！");  
	        		          }  
	        		     }); 
	        		 }else{
	        			 toastr.warning("上传文件为空，请选择要导入的文件！");  
	        		}
	        	}
	        	
            </script>
        </div>
        <table id="tb_departments"></table>
    </div>
    
    <div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
   		<div class="modal-dialog" role="document">
    		<div class="modal-content">
      			<div class="modal-header">
        			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        			<h4 class="modal-title" id="exampleModalLabel">
        				<span>excel导入</span>
        			</h4>
      			</div>
      			<div class="modal-body">
	          		<div style="text-align:right;padding:5px">
                        <a href="${pageContext.request.contextPath }/datas/staff.xls" onclick="javascript:Preview();">
                            <img alt="导入员工信息-模板" src="${pageContext.request.contextPath }/image/excel_alt_1.png" style="width: 20px;"/>
                            <span style="font-size:larger;font-weight:200;color:red">staff-模板.xls</span>
                        </a>
                    </div>
	        		<form id="importForm" class="form-horizontal">
	          			<div title="Excel导入操作" style="padding: 5px">
					            <input id="fileInput" name="file" type="file" accept=".xls,.xlsx"/>
	          			</div>
	        		</form>
	        		 <!--数据显示表格-->
                    <table id="gridImport" class="table table-striped table-bordered table-hover" cellpadding="0" cellspacing="0" border="0">
                    </table>
	      		</div>
       			<div class="modal-footer"> 
				        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				        <button type="submit"  name="submit"  class="btn btn-primary" id="ss" onclick="uploadBtn()">导入</button>
	      		</div>
    		</div>
  		</div>
	</div>
    
    
      <div class="modal fade bs-example-modal-lg" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
   		<div class="modal-dialog modal-lg" role="document">
    		<div class="modal-content">
      			<div class="modal-header">
        			<button type="button" class="close closefm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        			<h4 class="modal-title" id="exampleModalLabel">
        				<span id="bt" style="font-size:13px"></span>
        			</h4>
      			</div>
      			<div class="modal-body">
	        		<form id="fm" class="form-horizontal"  style="margin-right: 5%;">
	          			<div class="form-group">
	           				 <label class="col-sm-2 control-label">账号:</label>
	            			 <div class="col-sm-4"> 
		            			 <input type="text" class="form-control" id="scode" name="scode"  placeholder="请输入" autocomplete="off">
		            			 <input type="hidden" id="staid" name="staid" >
		          				<span class="xing"></span>
	          				</div>
				            
				            <label class="col-sm-2 control-label">姓名:</label>
				            <div class="col-sm-4"> 
					            <input type="text" class="form-control" id="sname" name="sname"  placeholder="请输入" autocomplete="off">
		          				<span class="xing"></span>
	          				</div>
	          			</div>
	          			
	          			<div class="form-group">
							<label class="col-sm-2 control-label">密码:</label>
							<div class="col-sm-4"> 
								<input type="password" name="pass" id="pass" class="col-xs-12 col-sm-4 form-control"/>
	          				</div>
							
							<label class="col-sm-2 control-label">再次输入密码:</label>
							<div class="col-sm-4"> 
								<input type="password" name="pass2" id="pass2" class="col-xs-12 col-sm-4 form-control" />
							</div>
						</div>
   			
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">性别:</label>
				          	<div class="col-sm-4"> 
				          		<select id="sex" name="sex" class="form-control selectpicker" >
									<option value="">没有选中任何项</option>
									<option>男</option>
									<option>女</option>
								</select>
		          				 <span class="xing"></span>
	          				 </div>
				            
				            <label  class="col-sm-2 control-label">出生日期:</label>
							<div class="col-sm-4"> 
								<input type="text" id="sbir" name="sbir" class="form_datetime form-control">
		          				 <span class="xing"></span>
	          				 </div>
	          			</div>
	         		 	
	          			<div class="form-group">
				            <!-- <label  class="col-sm-2 control-label">地区:</label>
							<div class="col-sm-4"> 
								<select id="rid" name="rid" class="form-control selectpicker" >
					        	</select>
					        	<script type="text/javascript">
					                $(function(){
					                    $.ajax({
							                type: "post",
							                url: "${pageContext.request.contextPath }/reg/queryAll.do",
							                dataType: 'JSON',
							                async: false,
							                success: function (data) {
							                      //设置下拉列表中的值的属性
							                      for ( var i = 0; i < data.length; i++) {
							                    	  	if (data[i].rid != $.trim($('#rid').val())) {
									                        //增加下拉列表。
									                        $("#rid").append("<option value='"+data[i].rid+"'>"+data[i].rname+"</option>");
														}
												 }
							                    //必须执行，否则数据新增失败
							                     $('#rid').selectpicker('refresh'); 
							                }
							            });
					                });
					        	</script>
		          				 <span class="xing"></span>
	          				 </div> -->
	          				 
				            <label  class="col-sm-2 control-label">部门:</label>
							<div class="col-sm-4"> 
								<select id="did" name="did" class="form-control selectpicker" >
					        	</select>
					        	<script type="text/javascript">
					                $(function(){
					                    $.ajax({
							                type: "post",
							                url: "${pageContext.request.contextPath }/department/queryAll.do",
							                dataType: 'JSON',
							                async: false,
							                success: function (data) {
							                      //设置下拉列表中的值的属性
									              $("#did").append('<option value="">请选择</option>');
							                      for ( var i = 0; i < data.length; i++) {
							                    	  	if (data[i].did != $.trim($('#did').val())) {
									                        //增加下拉列表。
									                        $("#did").append("<option value='"+data[i].did+"'>"+data[i].dname+"</option>");
														}
												 }
							                    //必须执行，否则数据新增失败
							                     $('#did').selectpicker('refresh'); 
							                     //$('#departmentid').selectpicker('render'); 
							                }
							            });
					                });
					        	</script>
	          				 </div>
	          				 
	          				 
	          				 <label  class="col-sm-2 control-label">电话:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="sway" name="sway"  placeholder="请输入" autocomplete="off">
	          				 </div>
	          			</div>
	          			
	          			
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">职务:</label>
							<div class="col-sm-4"> 
								<select id="pid" name="pid" class="form-control selectpicker" >
					        	</select>
					        	<script type="text/javascript">
					                $(function(){
					                    $.ajax({
							                type: "post",
							                url: "${pageContext.request.contextPath }/job/queryAll.do",
							                dataType: 'JSON',
							                async: false,
							                success: function (data) {
							                      //设置下拉列表中的值的属性
							                      
							                      $("#pid").append('<option value="">请选择</option>');
							                      for ( var i = 0; i < data.length; i++) {
							                    	  	if (data[i].jid != $.trim($('#pid').val())) {
									                        //增加下拉列表。
									                        $("#pid").append("<option value='"+data[i].jid+"'>"+data[i].jname+"</option>");
														}
												 }
							                    //必须执行，否则数据新增失败
							                     $('#pid').selectpicker('refresh'); 
							                     //$('#departmentid').selectpicker('render'); 
							                }
							            });
					                });
					        	</script>
		          				 <span class="xing"></span>
	          				 </div>
				           
				            <label  class="col-sm-2 control-label">学历:</label>
							<div class="col-sm-4"> 
								<select id="seducation" name="seducation" class="form-control selectpicker" >
									<option value="">没有选中任何项</option>
									<option>小学</option>
									<option>初中</option>
									<option>高中</option>
									<option>初中中专</option>
									<option>高中中专</option>
									<option>大专</option>
									<option>本科</option>
									<option>研究生</option>
								</select>
		          				 <span class="xing"></span>
	          				 </div>
	          			</div>
	          			
	          			<!-- <div class="form-group">
				            <label  class="col-sm-2 control-label">学校:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="sschool" name="sschool"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
				            
				            <label  class="col-sm-2 control-label">专业:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="smajor" name="smajor"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
	          			</div>
	          			
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">QQ:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="sqq" name="sqq"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
				           
				            <label  class="col-sm-2 control-label">邮箱:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="smail" name="smail"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
	          			</div>
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">家庭住址:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="saddress" name="saddress"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
				            
				            <label  class="col-sm-2 control-label">紧急联系人:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="sman" name="sman"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
	          			</div>
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">紧急联系方式:</label>
							<div class="col-sm-4"> 
								<input type="text" class="form-control" id="stele" name="stele"  placeholder="请输入" autocomplete="off">
		          				 <span class="xing"></span>
	          				 </div>
	          			</div> -->
	          			<div class="form-group">
	          			 <label  class="col-sm-2 control-label">是否有审批权限:</label>
							<div class="col-sm-4"> 
								<select id="sreserve2" name="sreserve2" class="form-control selectpicker" >
									<option value="">没有选中任何项</option>
									<option>是</option>
									<option>否</option>
								</select>
	          				 </div>
	          				 <label  class="col-sm-2 control-label">员工角色:</label>
							<div class="col-sm-4"> 
								<select id="sreserve3" name="sreserve3" class="form-control selectpicker" >
									<option value="">没有选中任何项</option>
									<option>管理员</option>
									<option>业务管理员</option>
									<option>普通用户</option>
								</select>
	          				 </div>
	          			</div>
	          			
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">备注:</label>
							<div class="col-sm-10"> 
								<!-- <input type="text" class="form-control" id="sremark" name="sremark"  placeholder="请输入" autocomplete="off"> -->
	          				 	<textarea rows="3" class="form-control" cols="53" id="sremark" name="sremark">
	          				 	</textarea>
	          				 </div>
	          			</div>
	          			
	          			<div class="form-group">
				            <label  class="col-sm-2 control-label">签名信息:</label>
							<div class="col-sm-4"> 
								<input type="file" accept=".gif,.jpeg,.jpg,.bmp,.png"  id="photo" name="photo"  >
	          				 </div>
	          				 <label  class="col-sm-4 control-label">注意：请上传100k以内图片，格式：.gif,.jpeg,.jpg,.bmp,.png 均可，宽120px，高80px</label>
	          			</div>
	          			
	        			<div class="form-group"> 
				   			<div class="col-sm-3 col-sm-offset-10"> 
						        <button type="button" class="btn btn-default closefm" data-dismiss="modal" >关闭</button>
						        <button type="button" class="btn btn-primary" onclick="save()">保存</button>
			      			</div>
			      		</div>
	        		</form>
	      		</div>
    		</div>
  		</div>
	</div>
		<!-- 时间控件 -->
	<script type="text/javascript">
	    $(".form_datetime").datetimepicker({
			/* 显示格式 */       
	    	format: "yyyy-mm-dd",
	/*     	format: "yyyy-mm-dd hh:ii:ss", */
	        /* 完成关闭 */
	        autoclose: true,
	       /*  今天 时间按钮*/
	        todayBtn: true, 
	       /*  今天的时间变黄色 */
	        todayHighlight:true, 
	        /* 定位 */
	        pickerPosition: "bottom-left",
	        /* 最小值 */
	        /* startDate: "2013-02-14 10:00", */
	        minuteStep: 10,
	        /*  语言 */
	        language: 'zh-CN',  
			/* 分上午下午 */
	        showMeridian: true,
	        /* 分的所有 */
	        minuteStep:true,
	        clearBtn:true,// 自定义属性,true 显示 清空按钮 false 隐藏 默认:true
	        startView: 2,//月视图
			minView: 2//日期时间选择器所能够提供的最精确的时间选择视图
	    }).on('hide',function(e) {  
	        //e.preventDefault();		//e.preventDefault()阻止事件默认行为。
	    	e.stopPropagation(); //e.stopPropagation()阻止事件冒泡
	    	$('#fm').data('bootstrapValidator')  
            .updateStatus('isndate', 'NOT_VALIDATED',null)  
            .validateField('isndate');  
	    	$('#fm').data('bootstrapValidator')  
            .updateStatus('sbir', 'NOT_VALIDATED',null)  
            .validateField('sbir');  
    	});
	</script>
	<script type="text/javascript">
	$(function() {
		$("#fm").bootstrapValidator({
			feedbackIcons : {
				valid : 'glyphicon glyphicon-ok',
				invalid : 'glyphicon glyphicon-remove',
				validating : 'glyphicon glyphicon-refresh'
			},
			fields : {
				scode : {
					validators : {
						notEmpty : {
							message : '账号不能为空'
						},
					}
				},
				sname : {
					validators : {
						notEmpty : {
							message : '姓名不能为空'
						},
					}
				},
				/* sex : {
					validators : {
						notEmpty : {
							message : '性别不能为空'
						},
					}
				}, */
				sbir : {
					validators : {
						/*  notEmpty : {
							message : '出生日期不能为空'
						},  
						regexp: {
	                         regexp:  /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/,
	                         message: '日期格式不正确，正确格式为：2014-01-01"'
	                     }*/
					}
				},
				pass : {
					validators : {
						/* notEmpty : {
							message : '密码不能为空'
						}, */
					}
				}, 
				
				pass2 : {
					validators : {
						/* notEmpty : {
							message : '密码不能为空'
						}, */ 
						identical: {
							field: 'pass',
							message: '与密码不等，请重新确认密码'
						},  
					}
				},
				
			
				/* rid : {
					validators : {
						notEmpty : {
							message : '地区不能为空'
						},
						regexp: {
	                         regexp:  /^[1-9]\d*$/,
	                         message: '请选择地区'
	                     }
					}
				}, */
				/* did : {
					validators : {
						notEmpty : {
							message : '部门不能为空'
						}, 
						 regexp: {
	                         regexp:  /^[1-9]\d*$/,
	                         message: '请选择部门'
	                     } 
					}
				},
				pid : {
					validators : {
						 notEmpty : {
							message : '职务不能为空'
						},
						 regexp: {
	                         regexp:  /^[1-9]\d*$/,
	                         message: '请选择职务'
	                     } 
					}
				},
				seducation : {
					validators : {
						notEmpty : {
							message : '学历不能为空'
						},
					}
				},
				 sschool : {
					validators : {
						notEmpty : {
							message : '学校不能为空'
						},
					}
				},
				smajor : {
					validators : {
						notEmpty : {
							message : '专业不能为空'
						},
					}
				}, 
				
				isndate : {
					validators : {
						notEmpty : {
							message : '入社日期不能为空'
						},
						regexp: {
	                         regexp:  /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/,
	                         message: '日期格式不正确，正确格式为：2014-01-01"'
	                     }
					}
				}, */
				
				sway : {
					validators : {
						/* notEmpty : {
							message : '联系方式不能为空'
						}, */
						stringLength: {
	                         min: 11,
	                         max: 11,
	                         message: '请输入联系方式'
	                     }, 
	                     regexp: {
	                         regexp:    /^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/,
	                         message: '请输入正确的联系方式'
	                     }
					}
				}, 
				
				sreserve3 : {
					validators : {
						notEmpty : {
							message : '员工角色不能为空'
						},
					}
				}, 
				/* sqq : {
					validators : {
						notEmpty : {
							message : 'QQ不能为空'
						},
	                     regexp: {
	                         regexp:    /[1-9][0-9]{4,}/,
	                         message: '请输入正确的QQ'
	                     }
					}
				}, 
				smail : {
					validators : {
						notEmpty : {
							message : '邮箱不能为空'
						},
	                     regexp: {
	                         regexp:    /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
	                         message: '请输入正确的邮箱'
	                     }
					}
				}, 
				
				saddress : {
					validators : {
						notEmpty : {
							message : '请输入家庭住址'
						},
					}
				}, 
				sman : {
					validators : {
						notEmpty : {
							message : '请输入紧急联系人'
						},
					}
				}, 
				stele : {
					validators : {
						notEmpty : {
							message : '联系方式不能为空'
						},
						stringLength: {
	                         min: 11,
	                         max: 11,
	                         message: '请输入紧急联系方式'
	                     }, 
	                     regexp: {
	                         regexp:    /^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/,
	                         message: '请输入正确的紧急联系方式'
	                     }
					}
				}, */
				
			},
		});
	});
	</script>
</body>
</html>